package main

import (
	"fmt"
	"reflect"
	"runtime"
	"time"
)

func speedTime(handle func() string) {
	t := time.Now()
	handle()
	elapsed := time.Since(t)
	// 利用反射获得函数名
	funcName := runtime.FuncForPC(reflect.ValueOf(handle()).Pointer()).Name()
	fmt.Print(funcName+" speedTime:", elapsed)
}

func main() {
	// https://golang-minibear2333.github.io/2.func-containers/2-1-func/

}
